from pathlib import PurePath
from typing import Any, Callable

from infection_monkey.exploit.tools import IRemoteAccessClientFactory
from infection_monkey.i_puppet import TargetHost

from .ssh_client import SSHClient
from .ssh_options import SSHOptions
from .ssh_remote_access_client import SSHRemoteAccessClient


class SSHRemoteAccessClientFactory(IRemoteAccessClientFactory):
    def __init__(
        self,
        host: TargetHost,
        options: SSHOptions,
        command_builder: Callable[[PurePath], str],
    ):
        self._host = host
        self._options = options
        self._command_builder = command_builder

    def create(self, **kwargs: Any) -> SSHRemoteAccessClient:
        return SSHRemoteAccessClient(self._host, self._options, self._command_builder, SSHClient())
